/*
 * @Author: your name
 * @Date: 2021-04-17 17:35:51
 * @LastEditTime: 2021-04-17 21:01:32
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-xmll\src\store\index.js
 */
//1.下载安装vuex

//2.引入vue,vuex
import vue from 'vue'
import Vuex from 'vuex'
import home from './home'
import userInfo from './userInfo'

import payInfo from '@/store/payInfo'

import allcategory from './allCategory'
import donation from './donation'

import detail from '@/store/detail'
import shopcart from '@/store/shopcart'
//3.往外暴露一个store对象
vue.use(Vuex)


//四个核心概念
//储存请求回来的数据
const state = {}
//直接改变数据的地方
const mutations = {}
//1.和vue组件交互  2.通知mutation修改数据
//actions中的方法,就是vue和vuex交互的桥梁 vue通过dispatch调用vuex中的方法更改数据
const actions = {}
//为了简化数据
const getters = {}


const store = new Vuex.Store({
  state,
  mutations,
  actions,
  getters,
  modules: {
    home,
    payInfo,
    allcategory,
    detail,
    shopcart,
    userInfo,
    donation
  }
})

export default store